package com.badibadi.fragment;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import net.tsz.afinal.FinalBitmap;

import org.json.JSONException;

import com.android.volley.toolbox.NetworkImageView;
import com.android.volley.toolbox.Volley;
import com.badibadi.activity.AddingRecordFirstActivity;
import com.badibadi.activity.LogReadingActivity;
import com.badibadi.activity.LogReadingDanjiActivity;
import com.badibadi.activity.MyFriendsResultActivity;
import com.badibadi.activity.PinyinSeeOtherPeopleFriendActivity;
import com.badibadi.activity.PinyinSeeRecordParticipantsActivity;
import com.badibadi.infos.MyFriendsModel;
import com.badibadi.infos.Record_Info_Model;
import com.badibadi.infos.Record_Info_Model_1;
import com.badibadi.infos.Record_Info_Model_2;
import com.badibadi.infos.Results;
import com.badibadi.infos.infoUserModle;
import com.badibadi.mytools.BitmapHelp;
import com.badibadi.mytools.Constants;
import com.badibadi.mytools.Convert;
import com.badibadi.mytools.Dialog;
import com.badibadi.mytools.DisplayUtil;
import com.badibadi.mytools.JSONUtils;
import com.badibadi.mytools.MyThreadTool;
import com.badibadi.mytools.Utils;
import com.badibadi.mytools.ViewHolder;
import com.badibadi.mytools.VolleyTools;
import com.badibadi.uniclubber.R;
import com.libjph.util.JsonUtil;
import com.libjph.util.StringUtil;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import com.test.pic.TestActivity;

import android.content.Intent;
import android.media.MediaRouter.VolumeCallback;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

//参加人数 article_area article_area zhan canjiazhe article_area ll_zhanName
public class LogReadingFragment0 extends BaseFragment {
	static LogReadingFragment0 logReadingFragment0;
	private LogReadingFragment0Adapter adapter;
	private ListView mlistView;
	private String rid;// 记录（篇）的id
	private String cid;// 俱乐部id（如果是个人的为null）
	private String admin_id;// 管理员id（如果是个人的就为null）
	private String TAG = "LogReadingFragment0";
	private Record_Info_Model record_Info_Model;

	// private FinalBitmap finalBitmap;
	private DisplayImageOptions options;
	private DisplayImageOptions options2;
	private String title = "";
	private int view = -1;
	private int discuss = -1;
	private int collect = -1;
	Results results3;
	List<Record_Info_Model_2> infos;// 保存过滤的头像
	private Handler handler = new Handler() {
		@Override
		public void handleMessage(Message msg) {
			switch (msg.what) {
			case 1:

				try {
					Utils.ExitPrgress(getActivity());
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_net_error));
				} catch (Exception e) {
					// TODO: handle exception
				}
				break;
			case 2:

				try {
					Utils.ExitPrgress(getActivity());
					initListView();
				} catch (Exception e) {
					// TODO: handle exception
				}

				break;
			case 3:

				try {
					Utils.ExitPrgress(getActivity());
					// Utils.showMessage(getActivity(),
					// getResources().getString(R.string.l_xb12));
					Constants.is_shuaxin = true;
					((LogReadingActivity) getActivity()).finish();
				} catch (Exception e) {
					// TODO: handle exception
				}

				break;
			case 4:

				try {
					Utils.ExitPrgress(getActivity());

					if (results3.isRet()) {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.wx_toupiao_success));
						record_Info_Model.setVote(""
								+ (Integer.parseInt(""
										+ record_Info_Model.getVote()) + 1));
						adapter.notifyDataSetChanged();
					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.wx_txt_69));
					}

				} catch (Exception e) {
					// TODO: handle exception
				}

				break;
			default:
				break;
			}
		}

	};

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// finalBitmap = FinalBitmap.create(getActivity());
		// finalBitmap.configLoadfailImage(R.drawable.noimage);
		// finalBitmap.configLoadingImage(R.drawable.noimage);
		rid = getArguments().getString("rid");
		cid = getArguments().getString("cid");
		admin_id = getArguments().getString("admin_id");

		options = new DisplayImageOptions.Builder()
				.showStubImage(R.drawable.ic_stub)
				.showImageForEmptyUri(R.drawable.noimage)
				.showImageOnFail(R.drawable.noimage).cacheInMemory()
				.cacheOnDisc().displayer(new RoundedBitmapDisplayer(5)).build();
		options2 = new DisplayImageOptions.Builder()
				.showStubImage(R.drawable.ic_stub)
				.showImageForEmptyUri(R.drawable.noimage)
				.showImageOnFail(R.drawable.noimage).cacheInMemory()
				.cacheOnDisc().displayer(new RoundedBitmapDisplayer(0)).build();
		LoadingInterNet();
	}

	/**
	 * 获取数据
	 */
	private void LoadingInterNet() {
		Utils.showPrgress(getActivity());
		MyThreadTool.fixedThreadPool.execute(new Runnable() {
			@Override
			public void run() {
				Map<String, Object> map = new HashMap<String, Object>();

				// String content = Utils.sendRequest(map, Constants.BadiUrl
				// + "friends");
				String content = Utils.getRequest(Constants.BadiUrl
						+ "record_info?rid=" + rid + "&uid="
						+ Utils.getUid(getActivity()) + "&languageType="
						+ Dialog.getSystemLanguageTypegrzx(getActivity()));
				//    (Constants.BadiUrl + "friends?uid=" + id
				// + "&page=" + page + "&pageNum=" + 10);
				if (content != null) {
					Results results = Utils.checkResult_NNN(getActivity(),
							content);
//					   
					if (results != null && !results.getRetmsg().equals("null")
							&& results.isRet()) {
//						   
						try {
							record_Info_Model = JSONUtils
									.getEntityByJsonString(results.getRetmsg(),
											Record_Info_Model.class);
//							   
//									"ssss===>" + record_Info_Model.getTitle());

							// 更新activity的标题
							title = record_Info_Model.getTitle();
							// 更新activity的浏览次数
							view = Integer.parseInt(record_Info_Model.getView());
//							   
//									"我是nickName===》"
//											+ record_Info_Model.toString());
							int dis = 0;
							int col = 0;
							// 更新activity的统计评论次数和收藏次数
							for (int i = 0; i < record_Info_Model.getArticle()
									.size(); i++) {
								dis = dis
										+ Integer.parseInt(record_Info_Model
												.getArticle().get(i)
												.getDiscuss());
								// col = col
								// + Integer
								// .parseInt(record_Info_Model
								// .getArticle().get(i)
								// .getShare());

							}
							discuss = dis;
							collect = Integer.parseInt(record_Info_Model
									.getCollect());

							handler.sendEmptyMessage(2);
						} catch (Exception e) {
							   
						}
					} else {
						handler.sendEmptyMessage(3);
					}
				} else {
					handler.sendEmptyMessage(1);
				}
			}
		});
	}

	private void initListView() {
		// TODO Auto-generated method stub
//		   
		adapter = new LogReadingFragment0Adapter(record_Info_Model);
		mlistView.setAdapter(adapter);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.xml_listview, null);
		mlistView = (ListView) view.findViewById(R.id.listView);
		mlistView.setDivider(null);
		mlistView.setAdapter(adapter);

		mlistView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View view,
					int position, long arg3) {
				// TODO Auto-generated method stub

			}
		});
		// view.findViewById(R.id.join_people_number).setOnClickListener(new
		// View.OnClickListener() {
		//
		// @Override
		// public void onClick(View v) {
		// Intent intent=new
		// Intent(getActivity(),PinyinSeeParticipantsActivity.class);
		// startActivity(intent);
		// }
		// });

		return view;
	}

	@Override
	public void onPause() {
		super.onPause();
	}

	/**
	 * 
	 * @author Administrator
	 * 
	 */
	// TODO Auto-generated method stub
	class LogReadingFragment0Adapter extends BaseAdapter {

		/**
		 * 第一层
		 */
		private Record_Info_Model Info_Model;

		/**
		 * 第二层
		 */
		private List<Record_Info_Model_1> acticle;

		// /**
		// * 第三层
		// */
		// private List<Record_Info_Model_2> users;
		public LogReadingFragment0Adapter(Record_Info_Model Info) {
			Info_Model = Info;
//			   
			acticle = new ArrayList<Record_Info_Model_1>();
			acticle.add(new Record_Info_Model_1());
			acticle.addAll(Info_Model.getArticle());

		}

		@Override
		public int getCount() {
			return acticle.size();
		}

		@Override
		public int getItemViewType(int position) {

			if (position == 0) {
				return 0;
			} else {
				return 1;
			}
		}

		@Override
		public int getViewTypeCount() {

			return 3;
		}

		@Override
		public Object getItem(int position) {

			return null;
		}

		@Override
		public long getItemId(int position) {

			return 0;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {

			LayoutInflater inflater = LayoutInflater.from(getActivity());
			ViewHolder holder = new ViewHolder();
			int type = getItemViewType(position);
			if (convertView == null) {
				if (type == 0) {
					convertView = inflater.inflate(
							R.layout.logreadingfragment0_0, null);
					initTopViewID(convertView, holder);
				} else if (type == 1) {
					convertView = inflater.inflate(
							R.layout.logreadingfragment0_1, null);
					initOtherViewID(convertView, holder);

				}

			} else {
				holder = (ViewHolder) convertView.getTag();
			}

			if (type == 0) {

				setTopView(holder, Info_Model, position);

			} else if (type == 1) {

				setOtherView(holder, Info_Model, position, getCount());
			}

			return convertView;
		}

	}

	/**
	 * ListView顶部视图的id
	 * 
	 * @param convertView
	 * @param holder
	 */
	public void initTopViewID(View convertView, ViewHolder holder) {
		// TODO Auto-generated method stub
		holder.nickName = (TextView) convertView.findViewById(R.id.nickName);
		holder.timeandcolleat = (TextView) convertView
				.findViewById(R.id.timeandcolleat);
		holder.head = (ImageView) convertView.findViewById(R.id.head);

		holder.canjiazhehead = (LinearLayout) convertView
				.findViewById(R.id.canjiarenhead);
		holder.canjiarenshu = (TextView) convertView
				.findViewById(R.id.canjiarenshu);
		holder.is_vote = (Button) convertView.findViewById(R.id.is_vote);
		holder.vote = (TextView) convertView.findViewById(R.id.vote);
		holder.one = (TextView) convertView.findViewById(R.id.one);
		holder.l_one = (LinearLayout) convertView.findViewById(R.id.l_one);
		holder.two = (TextView) convertView.findViewById(R.id.two);
		holder.l_two = (LinearLayout) convertView.findViewById(R.id.l_two);
		holder.three = (TextView) convertView.findViewById(R.id.three);
		holder.l_three = (LinearLayout) convertView.findViewById(R.id.l_three);
		holder.four = (TextView) convertView.findViewById(R.id.four);
		holder.l_four = (LinearLayout) convertView.findViewById(R.id.l_four);
		holder.five = (TextView) convertView.findViewById(R.id.five);
		holder.ll_one = (LinearLayout) convertView.findViewById(R.id.ll_one);
		holder.ll_two = (LinearLayout) convertView.findViewById(R.id.ll_two);
		holder.ll_three = (LinearLayout) convertView
				.findViewById(R.id.ll_three);
		holder.ll_four = (LinearLayout) convertView.findViewById(R.id.ll_four);
		holder.ll_five = (LinearLayout) convertView.findViewById(R.id.ll_five);
		holder.ll_canjiarenhead=(LinearLayout)convertView.findViewById(R.id.ll_canjiarenhead);
		
		convertView.setTag(holder);
	}

	/**
	 * 把相同的id的用户过滤掉
	 * 
	 * @param info
	 * @return
	 */
	public List<Record_Info_Model_2> guolv(List<Record_Info_Model_2> info) {
		final List<Record_Info_Model_2> infos2 = new ArrayList<Record_Info_Model_2>();
		Set<Integer> set = new HashSet<Integer>();
		for (int i = 0; i < info.size(); i++) {
			if (info.get(i).getId() != null)
				set.add(Integer.parseInt(info.get(i).getId()));
		}
		//    

		Iterator i1 = set.iterator();
		while (i1.hasNext()) {
			Integer temp = (Integer) i1.next();
			//    
			// infos.add(info.get(temp));

			for (int i = 0; i < info.size(); i++) {
				if (("" + info.get(i).getId()).equals("" + temp)) {
					infos2.add(info.get(i));
					break;
				}
			}
		}
		return infos2;
	}

	/**
	 * listView顶部视图
	 * 
	 * @param holder
	 * @param Info_Model
	 * @param position
	 */
	public void setTopView(ViewHolder holder, Record_Info_Model Info_Model,
			int position) {
		// TODO Auto-generated method stub timeandcolleat
		int pos = position - 1;
		// 昵称
		if (Info_Model.getNickName() != null)
			holder.nickName.setText("" + Info_Model.getNickName());// 昵称
		// 投票数量
		if (Info_Model.getVote() != null)
			holder.vote.setText("" + Info_Model.getVote());

		if (Info_Model.getIs_vote().equals("1")) {// 允许投票
			if (Info_Model.getVoted().equals("0")) {// 没有投过票
				holder.is_vote.setOnClickListener(new View.OnClickListener() {

					@Override
					public void onClick(View v) {
						// TODO Auto-generated method stub
						// 在这里点击后投票
						vote(Utils.getUid(getActivity()), rid);
					}
				});


			} else if (Info_Model.getVoted().equals("1")) {// 已经投过票
				holder.is_vote
						.setBackgroundResource(R.drawable.yuanpan_selector);
			}
		} else if (Info_Model.getIs_vote().equals("2")) {// 不允许投票
			holder.is_vote.setVisibility(View.GONE);
			holder.vote.setVisibility(View.GONE);
		}
		// // 是否投票
		// holder.is_vote.setOnClickListener(new View.OnClickListener() {
		//
		// @Override
		// public void onClick(View v) {
		// // TODO Auto-generated method stub
		// vote(Utils.getUid(getActivity()), rid);
		// }
		// });
		// 统计参加人数
		List<Record_Info_Model_1> ar = new ArrayList<Record_Info_Model_1>();
		// fdsf
		// 参加者数量
		// int canjiashuliang = 0;

		holder.canjiazhehead.removeAllViews();
		holder.canjiazhehead.setGravity(Gravity.CENTER_VERTICAL
				| Gravity.CENTER_HORIZONTAL);
		// 用于看参与者的
		final List<Record_Info_Model_2> info = new ArrayList<Record_Info_Model_2>();// 用于看记录参与者
		for (int i = 0; i < Info_Model.getArticle().size(); i++) {
			if (Info_Model.getArticle().get(i).getUser() != null) {
				info.addAll(Info_Model.getArticle().get(i).getUser());
			}
		}
		// 对数据进行过滤操作，把相同id的过滤掉
		infos = new ArrayList<Record_Info_Model_2>();
		infos = guolv(info);
		// **************************************************
		for (int i = 0; i < infos.size(); i++) {

			LayoutInflater inflater = LayoutInflater.from(getActivity());
			View view = inflater.inflate(R.layout.aah, null);
			ImageView iv = (ImageView) view.findViewById(R.id.aah);

			iv.setPadding(DisplayUtil.dip2px(getActivity(), 1), 0,
					DisplayUtil.dip2px(getActivity(), 1), 0);

			iv.setOnClickListener(new View.OnClickListener() {

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					Intent intent = new Intent(getActivity(),
							PinyinSeeRecordParticipantsActivity.class);
					intent.putExtra("info", (Serializable) infos);
					startActivity(intent);
					getActivity().overridePendingTransition(R.anim.slide_left,
							R.anim.slide_right);
				}
			});
			try {
				// finalBitmap.display(iv, Constants.BadiDownImgUrl + "/"
				// + infos.get(i).getHead(),
				// DisplayUtil.dip2px(getActivity(), 49),
				// DisplayUtil.dip2px(getActivity(), 49));
				ImageLoader.getInstance().displayImage(
						Constants.BadiDownImgUrl + "/" + infos.get(i).getHead()
								+ Constants.appPhoto4img, iv, options);
			} catch (Exception e) {
				// TODO: handle exception
			}
			holder.canjiazhehead.addView(view);
			
			
		}
		holder.ll_canjiarenhead.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(infos!=null && !infos.isEmpty())
				{
					Intent intent = new Intent(getActivity(),
							PinyinSeeRecordParticipantsActivity.class);
					intent.putExtra("info", (Serializable) infos);
					startActivity(intent);
					getActivity().overridePendingTransition(R.anim.slide_left,
							R.anim.slide_right);
				}
			}
		});
		holder.canjiarenshu.setText("(" + infos.size() + ")");

		try {
			// 头像
			ImageLoader.getInstance().displayImage(
					Constants.BadiDownImgUrl + "/" + Info_Model.getHead()
							+ Constants.appPhoto4img, holder.head, options);
		} catch (Exception e) {
			// TODO: handle exception
		}
		SimpleDateFormat data = new SimpleDateFormat("yyyy.MM.dd");
		// 发表年月日
		String ymd = data.format((Double.parseDouble(Info_Model.getR_time()
				.trim()) * 1000));
		// 距离今天多少天
		// j_time
		String j_time = Info_Model.getJ_time();
		// 多少人收藏
		String collect = Info_Model.getCollect();
		holder.timeandcolleat.setText(ymd + " | " + j_time
				+ getResources().getString(R.string.wx_day) + " | " + collect
				+ getResources().getString(R.string.wx_txt_68));
		// // 1 可以投票 0不可以投票
		// if (Info_Model.getIs_vote().equals("1")) {
		// {
		// holder.is_vote.setSelected(false);
		// holder.is_vote.setOnClickListener(new View.OnClickListener() {
		//
		// @Override
		// public void onClick(View v) {
		// // TODO Auto-generated method stub
		// // 在这里点击后投票
		// }
		// });
		// }
		// } else if (Info_Model.getIs_vote().equals("0")) {
		// holder.is_vote.setSelected(true);
		// holder.is_vote.setOnClickListener(new View.OnClickListener() {
		//
		// @Override
		// public void onClick(View v) {
		// // TODO Auto-generated method stub
		// // 这里是为了防止viewHolder的特性
		// }
		// });
		//
		// }
		// 下面的全是标签的判断
		String a = Info_Model.getTypeName();
		String[] b = a.split(",");
		//    
		//    
		if (b.length > 0)
			holder.one.setText("" + b[0]);
		if (b.length > 1)
			holder.two.setText("" + b[1]);
		if (b.length > 2)
			holder.three.setText("" + b[2]);
		if (b.length > 3)
			holder.four.setText("" + b[3]);
		if (b.length > 4)
			holder.five.setText("" + b[4]);
		if (b.length <= 4) {
			holder.five.setVisibility(View.GONE);
			holder.l_four.setVisibility(View.GONE);
			holder.ll_five.setVisibility(View.GONE);
		}
		if (b.length <= 3) {
			holder.four.setVisibility(View.GONE);
			holder.l_three.setVisibility(View.GONE);
			holder.ll_four.setVisibility(View.GONE);
		}
		if (b.length <= 2) {
			holder.three.setVisibility(View.GONE);
			holder.l_two.setVisibility(View.GONE);
			holder.ll_three.setVisibility(View.GONE);
		}
		if (b.length <= 1) {
			holder.two.setVisibility(View.GONE);
			holder.l_one.setVisibility(View.GONE);
			holder.ll_two.setVisibility(View.GONE);
		}
		if (b.length <= 0) {
			holder.one.setVisibility(View.GONE);
			holder.ll_one.setVisibility(View.GONE);
		}
	}

	/**
	 * 除开顶部的视图id
	 * 
	 * @param convertView
	 * @param holder
	 */
	public void initOtherViewID(View convertView, ViewHolder holder) {
		// TODO Auto-generated method stub
		holder.startTimeandendTime = (TextView) convertView
				.findViewById(R.id.startTimeandendTime);
		holder.dijiji = (TextView) convertView.findViewById(R.id.dijiji);
		holder.image = (ImageView) convertView.findViewById(R.id.image);
		holder.ll_zhanName = (LinearLayout) convertView
				.findViewById(R.id.ll_zhanName);
		holder.title = (TextView) convertView.findViewById(R.id.title);
		convertView.setTag(holder);
	}

	/**
	 * 只有两种视图，除开顶部的视图
	 * 
	 * @param holder
	 * @param info_Model
	 * @param position
	 */
	public void setOtherView(ViewHolder holder, Record_Info_Model info_Model,
			final int position, int count) {
		// TODO Auto-generated method stub

		// int pox_=position;
		//    
		// final int pos=(count-1)-pox_;
		//    
		final int pos = position - 1;
		// 开始时间和结束时间
		String a1 = info_Model.getArticle().get(pos).getStart_time()
				.replaceAll("-", ".");
		String b1 = info_Model.getArticle().get(pos).getEnd_time()
				.replaceAll("-", ".");

		holder.startTimeandendTime.setText(a1 + " - " + b1);
		holder.dijiji.setText(getResources().getString(R.string.l_xb42)
				+ position//Convert.convert()
				+ getResources().getString(R.string.wx_ji));
		try {
			// VolleyTools.displayImageByNetworkImageView(getActivity(),
			// Constants.BadiDownImgUrl + "/"
			// + info_Model.getArticle().get(pos).getImage(),
			// holder.image);

			// ImageLoader.getInstance().displayImage(
			// Constants.BadiDownImgUrl + "/"
			// + info_Model.getArticle().get(pos).getImage()
			// + Constants.Appactivitycover, holder.image,
			// options2);
			new BitmapHelp().displayImage(getActivity(), holder.image,
					Constants.BadiDownImgUrl + "/"
							+ info_Model.getArticle().get(pos).getImage()
							+ Constants.Appactivitycover);

		} catch (Exception e) {
			// TODO: handle exception
		}
		holder.image.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getActivity(),
						LogReadingDanjiActivity.class);
				if (record_Info_Model.getArticle().get(pos).getAid() != null) {
					intent.putExtra("rid", rid);
					intent.putExtra("f_uid", record_Info_Model.getUid());
					intent.putExtra("aid",
							record_Info_Model.getArticle().get(pos).getAid());
					intent.putExtra("cid", cid);
					intent.putExtra("admin_id", admin_id);
					intent.putExtra("position", position);
					startActivity(intent);
				}

			}
		});
		// 添加站点
		String zhan_name = info_Model.getArticle().get(pos).getZhan_name();
		String[] b = zhan_name.split(",");
		holder.ll_zhanName.removeAllViews();
		for (int i = 0; i < b.length; i++) {
			if (!b[i].equals("")) {
				Utils.AddCity(getActivity(), b[i], holder.ll_zhanName);
			}

		}
		if (info_Model.getArticle().get(pos).getTitle() != null) {
			holder.title.setText(""
					+ info_Model.getArticle().get(pos).getTitle());
		}

	}

	static class ViewHolder {
		public LinearLayout ll_canjiarenhead;
		public TextView nickName;// 发表用户的
		public TextView timeandcolleat;
		public LinearLayout canjiazhehead;// 参加者头像
		public ImageView head;// 发表用户头像
		public Button is_vote;// 是否可以投票 1表示可以 0 不可以
		public TextView canjiarenshu;// 参加人数
		// 五个标签
		public TextView one;
		public TextView two;
		public TextView three;
		public TextView four;
		public TextView five;

		public LinearLayout l_one;
		public LinearLayout l_two;
		public LinearLayout l_three;
		public LinearLayout l_four;

		public LinearLayout ll_one;
		public LinearLayout ll_two;
		public LinearLayout ll_three;
		public LinearLayout ll_four;
		public LinearLayout ll_five;

		public TextView vote;// 目前的票数

		public TextView uid;// 发表用户的id
		public TextView r_time;// 记录发表的时间
		public TextView j_time;// 记录时间距今天多少
		public TextView collect;// 被收藏的次数

		public TextView typeName;// 记录的标签名字 格式
									// $typeName1,$typeName2,$typeName3,$typeName4,$typeName5
		public TextView p_num;// @的人数
		public List<Record_Info_Model_1> acticle;// 记

		// **
		// startTimeandendTime
		// 下面的是记的
		public TextView startTimeandendTime;
		// 第几记
		public TextView dijiji;
		public ImageView image;
		public LinearLayout ll_zhanName;
		public TextView title;
	}

	public static LogReadingFragment0 getInstance() {
		if (logReadingFragment0 == null) {
			return new LogReadingFragment0();
		}
		return logReadingFragment0;
	}

	private void vote(final String uid, final String rid) {
		Utils.showPrgress(getActivity());
		MyThreadTool.fixedThreadPool.execute(new Runnable() {

			@Override
			public void run() {
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("rid", rid);
				map.put("uid", uid);
//				   ("投票数据提交的是:" + map.toString());
				String content = Utils.sendRequest(map, Constants.BadiUrl
						+ "vote");
				if (content != null) {
//					   ("返回的投票数据是:" + content);
					results3 = Utils.checkResult_NNN(getActivity(), content);
					if (results3 != null
							&& !results3.getRetmsg().equals("null")) {
						handler.sendEmptyMessage(4);
					} else {
						handler.sendEmptyMessage(3);
					}
				} else {
					handler.sendEmptyMessage(1);
				}
			}
		});
	}

	/**
	 * 
	 * 设置标题
	 * 
	 * @param set
	 */
	public void setRecordTitle(setActivityView set) {
		set.setRecordData(title, view, discuss, collect);
	}

	public interface setActivityView {
		void setRecordData(String title, int view, int discuss, int collect);
	}
}
